package fzu.functiongather.ProgressBar;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import fzu.functiongather.R;
import fzu.functiongather.Utils.RoundProgressbar;

/**
 * Created by WLT on 2016/7/13.
 */
public class ProgressBarActivity extends Activity {
    private static final int MSG_UPDATE=0X110;//消息
    private Handler mHandler=new Handler(){
        @Override
        public void handleMessage(Message msg) {
            int progress=Progress.getProgress();
            Progress.setProgress(++progress);
            if(progress>=100){
                mHandler.removeMessages(MSG_UPDATE);//不需要消息，移除
            }
            mHandler.sendEmptyMessageDelayed(MSG_UPDATE,100);//每次延迟100ms发送
        }
    };

    // private HorizontalProgressbar Progress;                                 //条形
     private RoundProgressbar Progress;                                      //圆形
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // setContentView(R.layout.progressbar_horizontal_main);              //条形
           setContentView(R.layout.progressbar_round_main);                    //圆形
       //  Progress=(HorizontalProgressbar)findViewById(R.id.id_progress01);  //条形
           Progress=(RoundProgressbar)findViewById(R.id.id_progress02);    //圆形
        mHandler.sendEmptyMessage(MSG_UPDATE);

    }
}
